All files / src/components/admin/systemConfiguration PublicEndpointsCard.tsx

0% Statements 0/8
100% Branches 0/0
0% Functions 0/3
0% Lines 0/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64                                                                                                                               
'use client';
 
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Label } from '@/components/ui/label';
import { Switch } from '@/components/ui/switch';
import { Separator } from '@/components/ui/separator';
import { Settings } from 'lucide-react';
 
export type PublicEndpointsCardProps = {
  t: (key: string, options?: Record<string, any>) => string;
  config: any;
  parseBoolConfig: (val: unknown) => boolean;
  toggleConfig: (key: string, current: boolean) => void;
  isUpdating: boolean;
};
 
export default function PublicEndpointsCard({
  t,
  config,
  parseBoolConfig,
  toggleConfig,
  isUpdating}: PublicEndpointsCardProps) {
  return (
    <Card>
      <CardHeader>
        <CardTitle className="flex items-center gap-2">
          <Settings className="h-5 w-5" />
          {t('systemConfiguration.publicEndpointsTitle', {})}
        </CardTitle>
        <CardDescription>
          {t('systemConfiguration.publicEndpointsDescription', {})}
        </CardDescription>
      </CardHeader>
      <CardContent>
        <div className="flex items-center justify-between gap-4 py-2">
          <div>
            <Label className="text-sm font-medium">{t('systemConfiguration.publicDemoLabel', {})}</Label>
            <p className="text-xs text-muted-foreground">{t('systemConfiguration.publicDemoDescription', {})}</p>
          </div>
          <Switch
            checked={parseBoolConfig((config as any).public_demo_enabled)}
            onCheckedChange={() => toggleConfig('public_demo_enabled', parseBoolConfig((config as any).public_demo_enabled))}
            aria-label={t('systemConfiguration.publicDemoLabel')}
            disabled={isUpdating}
          />
        </div>
        <Separator />
        <div className="flex items-center justify-between gap-4 py-2">
          <div>
            <Label className="text-sm font-medium">{t('systemConfiguration.publicRedeemLabel', {})}</Label>
            <p className="text-xs text-muted-foreground">{t('systemConfiguration.publicRedeemDescription', {})}</p>
          </div>
          <Switch
            checked={parseBoolConfig((config as any).public_redeem_enabled)}
            onCheckedChange={() => toggleConfig('public_redeem_enabled', parseBoolConfig((config as any).public_redeem_enabled))}
            aria-label={t('systemConfiguration.publicRedeemLabel')}
            disabled={isUpdating}
          />
        </div>
      </CardContent>
    </Card>
  );
}